import time
import tkinter as tk

class Window:
    def __init__(self, title='nms', width=600, height=320, staFunc=bool, stoFunc=bool):
        self.w = width
        self.h = height
        self.stat = True
        self.staFunc = staFunc
        self.stoFunc = stoFunc
        self.staIco = None
        self.stoIco = None

        self.root = tk.Tk(className=title)

    def center(self):
        ws = self.root.winfo_screenwidth()
        hs = self.root.winfo_screenheight()
        x = int( (ws/2) - (self.w/2) )
        y = int( (hs/2) - (self.h/2) )
        self.root.geometry('{}x{}+{}+{}'.format(self.w, self.h, x, y))

    def packBtn(self):
        self.btnSer = tk.Button(self.root, command=self.event, width=25, height=10)
        self.btnSer.pack(padx=20, side='left')
        btnQuit = tk.Button(self.root, text='开始画图', command=self.root.quit, width=25, height=10)
        btnQuit.pack(padx=20, side='right')

    def event(self):
        self.btnSer['state'] = 'disabled'
        if self.stat:
            if self.stoFunc():
                self.btnSer['text'] = '组员:韩立栋，韩昊乐，樊凯.'
                self.stat = False
                self.root.iconbitmap(self.stoIco)
            else:
             if self.staFunc():
                self.btnSer['text'] = '软工十二班.'
                self.stat = True
                self.root.iconbitmap(self.staIco)
        self.btnSer['state'] = 'active'

    def loop(self):
        self.root.resizable(False, False)   
        self.packBtn()
        self.center()                       
        self.event()
        self.root.mainloop()
'''
Created on Nov 18,2017

@author:QiZhao
'''
import turtle


turtle.penup()
turtle.left(90)
turtle.fd(200)
turtle.pendown()
turtle.right(90)

#花蕊
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(10,180)
turtle.circle(25,110)
turtle.left(50)
turtle.circle(60,45)
turtle.circle(20,170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30,110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90,70)
turtle.circle(30,150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80,90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150,80)
turtle.left(50)
turtle.circle(150,90)
turtle.end_fill()

#花瓣1
turtle.left(150)
turtle.circle(-90,70)
turtle.left(20)
turtle.circle(75,105)
turtle.setheading(60)
turtle.circle(80,98)
turtle.circle(-90,40)

#花瓣2
turtle.left(180)
turtle.circle(90,40)
turtle.circle(-80,98)
turtle.setheading(-83)

#叶子1
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-80,90)
turtle.right(90)
turtle.circle(-80,90)
turtle.end_fill()

turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)

#叶子2
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80,90)
turtle.left(90)
turtle.circle(80,90)
turtle.end_fill()

turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200,60)


            


             

              
              
from tkinter import *
window = Tk()
window.title("tkinter")  #窗口标题
window.geometry("800x600")
canvas = Canvas(window,width = 700,height = 500,bg = "lightblue")
canvas.pack()
#右手
canvas.create_oval(275,335,335,395,fill="white")
canvas.create_polygon(215,260,315,335,285,365,230,305,fill = "blue",outline = "black")

canvas.create_oval(205,425,290,475,fill="white")
canvas.create_oval(205,425,115,475,fill="white")

canvas.create_oval(73,335,133,395,fill="white")
canvas.create_polygon(190,260,90,335,120,365,205,305,fill = "blue",outline = "black")

canvas.create_oval(115,285,285,450,fill="blue")
canvas.create_oval(130,300,268,428,fill="white")
canvas.create_arc(143,285,256,418,extent = -180,fill="white")

canvas.create_oval(100,110,300,300,fill="blue")
canvas.create_oval(110,140,290,300,fill="white")

canvas.create_oval(184,160,210,185,fill="red")
canvas.create_oval(193,165,202,174,fill="white")

canvas.create_oval(196,122,230,167,fill="white")
canvas.create_oval(162,122,196,167,fill="white")

canvas.create_oval(170,130,188,155,fill="black")
canvas.create_oval(174,134,184,144,fill="white")

canvas.create_oval(204,130,222,155,fill="black")
canvas.create_oval(208,134,218,144,fill="white")

canvas.create_arc(125,150,275,286,extent = -180,fill="red")
# canvas.create_arc(275,275,200,200,extent = -180,style = ARC)

canvas.create_line(198,185,198,220,fill = "black")

canvas.create_line(123,165,178,190,fill = "black")
canvas.create_line(113,195,178,196,fill = "black")
canvas.create_line(113,220,178,202,fill = "black")


# canvas.create_rectangle(155,220,170,240,fill = "white")
# canvas.create_rectangle(170,220,185,240,fill = "white")
canvas.create_rectangle(185,219,200,240,fill = "white")
canvas.create_rectangle(200,219,215,240,fill = "white")
# canvas.create_rectangle(215,220,230,240,fill = "white")
# canvas.create_rectangle(230,220,245,240,fill = "white")

canvas.create_rectangle(143,303,258,288,fill = "red")
canvas.create_oval(184,195,215,325,fill = "gold")
canvas.create_rectangle(184,311,215,304,fill = "gold")
canvas.create_oval(195,313,203,320,fill="black")





canvas.create_oval(575,335,635,395,fill="white")

canvas.create_polygon(515,260,615,335,585,365,530,305,fill = "pink",outline = "black")

canvas.create_oval(505,425,590,475,fill="white")
canvas.create_oval(505,425,415,475,fill="white")

canvas.create_oval(373,335,433,395,fill="white")
canvas.create_polygon(490,260,390,335,420,365,505,305,fill = "pink",outline = "black")

canvas.create_oval(415,285,585,450,fill="pink")
canvas.create_oval(430,300,568,428,fill="white")
canvas.create_arc(443,285,556,418,extent = -180,fill="white")

canvas.create_oval(400,110,600,300,fill="pink")
canvas.create_oval(410,140,590,300,fill="white")

canvas.create_oval(484,160,510,185,fill="red")
canvas.create_oval(493,165,502,174,fill="white")

canvas.create_oval(496,122,530,167,fill="white")
canvas.create_oval(462,122,496,167,fill="white")

canvas.create_oval(470,130,488,155,fill="black")
canvas.create_oval(474,134,484,144,fill="white")

canvas.create_oval(504,130,522,155,fill="black")
canvas.create_oval(508,134,518,144,fill="white")
canvas.create_arc(425,150,575,286,extent = -180,fill="red")
# canvas.create_arc(275,275,200,200,extent = -180,style = ARC)

canvas.create_line(498,185,498,220,fill = "black")
canvas.create_line(413,195,478,196,fill = "black")
canvas.create_line(413,220,478,202,fill = "black")


canvas.create_line(580,165,518,190,fill = "black")
canvas.create_line(585,195,518,190,fill = "black")
canvas.create_line(585,220,518,202,fill = "black")

# canvas.create_rectangle(155,220,170,240,fill = "white")
# canvas.create_rectangle(170,220,185,240,fill = "white")
canvas.create_rectangle(485,219,500,240,fill = "white")
canvas.create_rectangle(500,219,515,240,fill = "white")
# canvas.create_rectangle(215,220,230,240,fill = "white")
# canvas.create_rectangle(230,220,245,240,fill = "white")

canvas.create_rectangle(443,303,588,288,fill = "red")
canvas.create_oval(484,295,515,325,fill="gold")
canvas.create_rectangle(484,311,515,304,fill = "gold")
canvas.create_oval(495,313,503,320,fill="black")
canvas.create_line(499,320,499,325,fill = "black")

window.mainloop() #让窗口一直存在









def sta():
    print('开始画图.')
    return True
def sto():
    print('玫瑰花和哆啦A梦.')
    return True

if __name__ == '__main__':
    import sys, os

    w = Window(staFunc=sta, stoFunc=sto)
    w.staIco = os.path.join(sys.exec_prefix, 'DLLs\pyc.ico')
    w.stoIco = os.path.join(sys.exec_prefix, 'DLLs\py.ico')
    w.loop()
